﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TiggerArea : MonoBehaviour
{
    int total = 0;
    public GameObject door;
    public GameObject press;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        //print(total);
        if (total >= 3)
        {
            door.GetComponent<Animator>().SetBool("Open", true);
            press.GetComponent<Animator>().SetBool("Down", true);
        }
        else
        {
            door.GetComponent<Animator>().SetBool("Open", false);
            press.GetComponent<Animator>().SetBool("Down", false);
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        //print("has");
        if(other.tag.Equals("MoveBox"))
        {
           // print("in");
            total++;
            //print(total);
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.tag.Equals("MoveBox"))
        {
            total--;
        }
    }
}
